<template>
	<div>
		<div class="top">
			<div class="head">
				<img @click="gohome" src="@/assets/image/order/矩形 3.png" alt="" />
				<p>选择收货地址</p>
				<span @click="newadd">新增收货地址</span>
			</div>
			<div class="input">
				<input type="text" placeholder=" 搜索地址" />
			</div>
		</div>
		<p class="now">&nbsp; 当前收货地址</p>
		<ul class="nowlist">
			<li v-if="nowlist.name">
				<div>
					<p class="addlist">{{ nowlist.addressDetail }}</p>
					<p>{{ nowlist.name }} {{ nowlist.tel }}</p>
				</div>

				<img src="@/assets/image/order/对号.png" alt="" />
			</li>
			<li v-else>
				<div>
					<p class="addlist">杭州</p>
					<p>周杰伦 5555555</p>
				</div>

				<img src="@/assets/image/order/对号.png" alt="" />
			</li>
		</ul>
		<p class="now">&nbsp; 我的收货地址</p>
		<ul class="oldlist">
			<li
				@click="setaddre(item)"
				v-for="(item, index) in addrelist"
				:key="index"
			>
				<p class="addlist">{{ item.addressDetail }}</p>
				<p>{{ item.name }} {{ item.tel }}</p>
			</li>
		</ul>
	</div>
</template>

<script>
export default {
	data() {
		return {
			addlist: {},
			addresslist: {},
			nowlist: {},
		}
	},

	components: {},

	computed: {
		addrelist() {
			return this.$store.state.addresslist
		},
	},

	created() {},

	methods: {
		gohome() {
			this.$router.go(-1)
		},
		newadd() {
			this.$router.push('/newaddress')
		},

		setaddre(item) {
			console.log(item)
			this.nowlist = item
			localStorage.setItem('areaCode', item.areaCode)
		},
	},
}
</script>

<style lang="less" scoped>
.top {
	background-color: #ffcc00 !important;
}
.head {
	height: 88px;
	display: flex;
	justify-content: space-between;
	align-items: center;

	border-radius: 10px;

	img {
		display: block;
		margin-left: 40px;
		height: 44px;
		width: 26px;
	}
	p {
		font-size: 40px;
		margin-left: 40px;
		font-weight: 500;
		color: #323232;
	}
	span {
		font-size: 30px;

		font-weight: 400;
		color: #646464;
	}
}
.input {
	width: 828px;
	height: 88px;
	background: #ffcc00;
	display: flex;
	align-items: center;
	flex: auto;
}
::placeholder {
	font-size: 30px;
	color: #d1d1d1;
	margin-left: 20px;
	text-indent: 1em;
}
input {
	font-size: 30px;

	font-weight: 400;
	color: #d1d1d1;
	width: 748px;
	height: 58px;

	background: #fff;
	border-radius: 29px;
	margin-left: 40px;
}
.now {
	font-size: 30px;

	font-weight: 400;
	color: #646464;
}
.nowlist {
	li {
		width: 745px;
		height: 115px;
		background: #f1f1f1;
		border-radius: 10px;
		margin: auto;
		font-size: 24px;

		font-weight: 400;
		color: #646464;
		display: flex;
		justify-content: space-between;
		img {
			display: block;
			width: 44px;
			height: 44px;
			margin-top: 40px;
		}
		.addlist {
			font-size: 30px;

			font-weight: 400;
			color: #646464;
			margin-bottom: 30px;
		}
	}
}
.oldlist {
	li {
		width: 745px;
		height: 115px;
		background: #f1f1f1;
		border-radius: 10px;
		margin: auto;
		font-size: 24px;

		font-weight: 400;
		color: #646464;
		.addlist {
			font-size: 30px;

			font-weight: 400;
			color: #646464;
			margin-bottom: 30px;
		}
	}
}
</style>
